#include "stdafx.h"
#include "PortList.h"

EnumList PortList;

HRESULT InitPortList()
{
    EnumItem *item;
    PortList.head = item = new EnumItem;
    if (item == NULL)
    {
        PortList.Release();
        return E_OUTOFMEMORY;
    }
    item->data.vt = VT_BSTR;
    item->data.bstrVal = SysAllocString(L"Port 1");
    if (item->data.bstrVal == NULL)
    {
        PortList.Release();
        return E_OUTOFMEMORY;
    }

    item->next = new EnumItem;
    if (item->next == NULL)
    {
        PortList.Release();
        return E_OUTOFMEMORY;
    }
    item = item->next;
    item->data.vt = VT_BSTR;
    item->data.bstrVal = SysAllocString(L"Port 2");
    if (item->data.bstrVal == NULL)
    {
        PortList.Release();
        return E_OUTOFMEMORY;
    }

    item->next = new EnumItem;
    if (item->next == NULL)
    {
        PortList.Release();
        return E_OUTOFMEMORY;
    }
    item = item->next;
    item->data.vt = VT_BSTR;
    item->data.bstrVal = SysAllocString(L"Port 3");
    if (item->data.bstrVal == NULL)
    {
        PortList.Release();
        return E_OUTOFMEMORY;
    }
    item->next = NULL;

    return S_OK;
}
